<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Compare extends CI_Controller {


	public function index()
	{	 
		$dv = array();
		
		$hg = array( 
				array("Name"=> "iPhone5c16","Brand"=> "Apple","Price"=> "Php 2000.00" , "Dimensions"=> "123.8 x 58.6 x 7.6 mm", "Weight"=> "112.00g" , "Qwerty" => "No", "Size"=> "4 inches" ,  "OS"=> "iOS7" ,"img"=> "http://shop.globe.com.ph/media/catalog/product/cache/2/small_image/200x/9df78eab33525d08d6e5fb8d27136e95/i/p/iphone5_white_16gb_violated_1.png"  ),
				array("Name"=> "iPhone5c32","Brand"=> "Apple","Price"=> "Php 20000.00" , "Dimensions"=> "123.8 x 58.6 x 7.6 mm", "Weight"=> "112.00g" , "Qwerty" => "No", "Size"=> "4 inches"  , "OS"=> "iOS7" ,"img"=> "http://shop.globe.com.ph/media/catalog/product/cache/2/small_image/200x/9df78eab33525d08d6e5fb8d27136e95/i/p/iphone5_white_16gb_violated_1.png"   ),
				array("Name"=> "Samsung Galaxy S4","Brand"=> "Samsung","Price"=> "Php 15000.00" , "Dimensions"=> "123.8 x 58.6 x 7.6 mm", "Weight"=> "112.00g" , "Qwerty" => "No", "Size"=> "4 inches"  , "OS"=> "Android Jellybean", "img" => "http://shop.globe.com.ph/media/catalog/product/cache/2/small_image/200x/9df78eab33525d08d6e5fb8d27136e95/s/a/samsungs4_back_postpaid_3_1.png"  ), 
				array("Name"=> "iPhone5s16","Brand"=> "Apple","Price"=> "Php 3000.00" , "Dimensions"=> "123.8 x 58.6 x 7.6 mm", "Weight"=> "112.00g" , "Qwerty" => "No", "Size"=> "4 inches"  , "OS"=> "iOS7" ,"img"=> "http://shop.globe.com.ph/media/catalog/product/cache/2/small_image/200x/9df78eab33525d08d6e5fb8d27136e95/i/p/iphone5_white_16gb_violated_1.png"   ),
				array("Name"=> "iPhone5c32a","Brand"=> "Apple","Price"=> "Php 5000.00" , "Dimensions"=> "123.8 x 58.6 x 7.6 mm", "Weight"=> "112.00g" , "Qwerty" => "No", "Size"=> "4 inches"  , "OS"=> "iOS7","img"=> "http://shop.globe.com.ph/media/catalog/product/cache/2/small_image/200x/9df78eab33525d08d6e5fb8d27136e95/i/p/iphone5_white_16gb_violated_1.png"   ),
				array("Name"=> "Nokia Lumia 625","Brand"=> "Apple","Price"=> "Php 20000.00" , "Dimensions"=> "123.8 x 58.6 x 7.6 mm", "Weight"=> "112.00g" , "Qwerty" => "No", "Size"=> "4 inches"  , "OS"=> "Nokia", "img" =>"http://shop.globe.com.ph/media/catalog/product/cache/2/small_image/200x/9df78eab33525d08d6e5fb8d27136e95/3/5/350x350_nokia_625_2.png" ),
				array("Name"=> "Samsung Galaxy Note II LTE","Brand"=> "Samsung","Price"=> "Php 15000.00" , "Dimensions"=> "123.8 x 58.6 x 7.6 mm", "Weight"=> "112.00g" , "Qwerty" => "No", "Size"=> "4 inches"  , "OS"=> "Android Jellybean","img" => "http://shop.globe.com.ph/media/catalog/product/cache/2/small_image/200x/9df78eab33525d08d6e5fb8d27136e95/s/a/samsungs4_back_postpaid_3_1.png"  ), 
				array("Name"=> "iPhone5s16","Brand"=> "Apple","Price"=> "Php 20000.00" , "Dimensions"=> "123.8 x 58.6 x 7.6 mm", "Weight"=> "112.00g" , "Qwerty" => "No", "Size"=> "4 inches"  , "OS"=> "iOS7", "img"=> "http://shop.globe.com.ph/media/catalog/product/cache/2/small_image/200x/9df78eab33525d08d6e5fb8d27136e95/i/p/iphone5_white_16gb_violated_1.png"  )
		);  

		//$sku = $this->uri->segment(2,0);
		//$sku = "cloudfone501d/nokia-asha-501";
                
		if(isset($_COOKIE['maitaicompare1'])) $sku = $_COOKIE['maitaicompare1'];

	        if((isset($_COOKIE['maitaicompare1']) && isset($_COOKIE['maitaicompare2'])) && ($_COOKIE['maitaicompare2']!=""))			
		$sku = $_COOKIE['maitaicompare1'] . "/" . $_COOKIE['maitaicompare2'];
		

		// Get single item
		if($sku!='') {
			$this->config->load('config_maitai_shopapi');
			
			// curl call
			$ch = curl_init($this->config->item('maitai_shopapi_url') . $sku);    // initialize curl handle
			curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
			$product_array = curl_exec($ch);  
			$product = json_decode($product_array,true);

			$d['comdev'] = $product;

		}
 
		 $views['_content'] = "compare";
		 $this->template->load('template_landing', $views, $d);

	}
	
	public function specification(){		
		 //specification
		 $d['hello'] ="data";		 
		 $views['_content'] = "specification";
		 $this->template->load('template_landing', $views, $d);
	}
	
}
